package com.example.fmgidsprototype.data;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class n_cst_common {
	public static String of_get_user_name(Context anv_context)
	{
		return of_get_preference(anv_context, "username");
	}
	
	public static String of_get_preference(Context anv_context, String as_key)
	{
		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(anv_context); 
		return preferences.getString(as_key, "n/a");		
	}
	
	public static void of_set_user_name(Context anv_context, String as_value)
	{
		of_set_preference(anv_context, "username", as_value);
	}
	
	public static void of_set_preference(Context anv_context, String as_key, String as_value)
	{
		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(anv_context); 
		
		Editor edit = preferences.edit();
		edit.putString("username", "new_value_for_user");
		edit.commit();
	}
}
